package experiment_6;

import java.util.*;

public class Subject {
    public static String[][] su1 = new String[5][4];
    public static String[][] su2 = new String[5][2];
    public static String[][] su3 = new String[5][1];
    static Scanner input = new Scanner(System.in);
    public String[][] sul = { { "SSE011", "HPH123", "FGW123", "HOH034", "KJK996",
            "LMB889", "MKM437", "LMN098", "PLP829" },
            { "语文", "数学", "英语", "历史", "生物", "物理", "地理", "化学", "政治" },
            { "教403", "图101", "教202", "教303", "图301", "教401", "教305", "图201", "图402" },
            { " 8:00-9:40", "10:00-11:40", "8:00-9:40", "13:30-15:10", "15:30-17:10", "19:00-21:25", "10:00-11:45",
                    " 15:30-17:10", " 19:00-20:35" },
            { " ", " ", " ", " ", " ", " ", " ", " ", " " } };

    public void Output_Curriculum() { // 输出课表
        for (int k = 0; k < sul[0].length; k++) {

            for (int i = 0; i < sul.length; i++) {
                System.out.print(sul[i][k] + "   ");
            }
            System.out.println();
        }
    }

    public void Start_class() { // 开课

        int i, a;
        String name;
        boolean fl = true;
        System.out.println("输入姓名");
        name = input.next();
        String aname = "teacher";
        while (fl) { // 判断是否是学校老师
            if (name.equals(aname)) {
                fl = false;
            }

            else {
                System.out.println("无此老师");
                name = input.next();

            }
        }
        System.out.println("老师开课");
        System.out.println("请输入1~9");

        for (i = 0; i < 4; i++) {
            a = input.nextInt();
            if (a <= 0 || a >= 10) { // 判断输入范围是否正确
                System.out.println("输入错误,重新输入");
                i--;
                continue;
            }

            for (int j = 0; j < sul.length; j++) { // 课表初始化
                su1[j][i] = sul[j][a - 1];
            }
        }
    }

    public void Output_Curr_Start() { // 得到开课课表

        for (int k = 0; k < su1[0].length; k++) {

            for (int i = 0; i < sul.length; i++) {
                System.out.print(su1[i][k] + "   ");
            }
            System.out.println();
        }
    }

    public void Course_selection() { // 选课
        System.out.println("学生选课");
        System.out.println("请输入1~4");
        int i, a;

        for (i = 0; i < 2; i++) {
            a = input.nextInt();
            if (a <= 0 || a >= 5) { // 判断范围
                System.out.println("输入错误,重新输入");
                i--;
                continue;
            }

            for (int j = 0; j < su1.length; j++) { // 初始化
                su2[j][i] = su1[j][a - 1];
            }
        }

    }

    public void Output_Curr_Course() { // 输出选课课表
        for (int k = 0; k < su2[0].length; k++) {

            for (int i = 0; i < su2.length; i++) {
                System.out.print(su2[i][k] + "   ");
            }
            System.out.println();
        }
    }

    public void Delete_class() { // 退课
        System.out.println("学生退课！");
        System.out.println("请输入1或2");
        System.out.println("请输入删除课程序号：");
        boolean f = true;
        while (f) { // 判断是否范围
            int j = input.nextInt();
            if (j <= 0 || j >= 3) {
                System.out.println("输入错误,重新输入");
            }
            if (j == 1) {

                for (int i = 0; i < su2.length; i++) {
                    su3[i][0] = su2[i][1];
                    f = false;
                }

            }
            if (j == 2) {
                for (int i = 0; i < su2.length; i++) {
                    su3[i][0] = su2[i][0];
                    f = false;
                }
            }
        }
    }

    public void getDelete_class() { // 输出选课课表
        for (int k = 0; k < su3[0].length; k++) {
            for (int i = 0; i < su3.length; i++) {
                System.out.print(su3[i][k] + "   ");
            }
            System.out.println();
        }
    }
}
